package com.foreveross.crawl.common.util;

import org.springframework.context.ApplicationContext;
/**
 * Spring辅助类
 * @author xiangsf 
 * @since 2013-1-31
 *
 */
public class SpringHelper {

	public static ApplicationContext applicationContext = null;
	
	public static void setApplicationContext(ApplicationContext ctx){
		applicationContext = ctx;
	}
	
	public static <T> T getBean(Class<T> clazz){
		return applicationContext.getBean(clazz);
	}
	
	public static <T> T getBean(Class<T> clazz, String name){
		return applicationContext.getBean(name, clazz);
	}
	
	public static Object getBean(String name){
		return applicationContext.getBean(name);
	}
}
